<!-- <style scoped src="./index.scss" lang="scss" rel="stylesheet/scss"></style> -->
<template src="./index.html"></template>
<script>
export default {
    mixins: [Vue.prototype.$vFN.Mixins.Base, Vue.prototype.$vFN.Mixins.Edit],
    components: {
        SelectIcon: async () =>
            Vue.extend(await Vue.prototype.$vFN.Components.Base.SelectIcon()),
    },
    data() {
        return {
            form: {
                // 上级菜单
                parentId: 0,
                // 菜单名称
                menuTitle: "",
                // 前端标识
                authName: "",
                // 菜单图标
                menuIcon: "",
                // 菜单分类
                menuType: "",
                // 存在URI
                existResUrl: 0,
                // URI地址
                resUrl: "",
                // 排序
                sort: "",
                // 菜单类型
                type: "",
            },

            // 数据字典
            // 菜单分类
            dict_menu_category: [],
            // 菜单类型
            dict_menu_type: [],

            // 页面接口地址
            apiUrl: {
                create: "mall-admin/menu/create",
                update: "mall-admin/menu/update",
                detail: "mall-admin/menu/getItem",
            },
        };
    },
    methods: {
        // 初始化
        async init() {
            // 初始化数据
            await this.mixinEdit_editBoxInit({
                model: "form",
                id: this.id,
                onInit: async () => {
                    // 数据字典 菜单分类
                    this.form.menuType = await this.mixinBase_configDict({
                        type: "menu_category",
                        name: "dict_menu_category",
                    });

                    // 数据字典 菜单类型
                    this.form.type = await this.mixinBase_configDict({
                        type: "menu_type",
                        name: "dict_menu_type",
                    });

                    return true;
                },
            });
            // 如存在父id  则在此父下创建菜单
            if (this.parentId) {
                this.form.parentId = this.parentId;
            }
        },
    },
    mounted() {
        this.init();
    },
    activated() {},
};
</script>